/*
 * @Description: 5-原型链继承.js
 * @Author: rendc
 * @Date: 2021-09-03 14:10:10
 * @LastEditors: rendc
 * @LastEditTime: 2021-09-03 14:17:56
 */
// 定义父类类型
function Animal () {
  this.name = "animal";
}
Animal.prototype.sayName = function () {
  console.log(this.name);
}
// 定义子类
function Dog () {
  this.color = "black";
}
// 将子构造函数的原型 指向父类对象的实例
Dog.prototype = new Animal();
Dog.prototype.sayColor = function () {
  console.log(this.color);
}
var dog = new Dog();
console.log(dog);
dog.sayName();
dog.sayColor();
